package mc

import (
	"gitee.com/dreamwood/ez-go/db/mgo"
)

const (
	SellerCategoryEventNew           = "erp.SellerCategoryNew"
	SellerCategoryEventBeforeCreate  = "erp.SellerCategoryBeforeCreate"
	SellerCategoryEventBeforeUpdate  = "erp.SellerCategoryBeforeUpdate"
	SellerCategoryEventBeforeSave    = "erp.SellerCategoryBeforeCreate erp.SellerCategoryBeforeUpdate"
	SellerCategoryEventAfterCreate   = "erp.SellerCategoryAfterCreate"
	SellerCategoryEventAfterUpdate   = "erp.SellerCategoryAfterUpdate"
	SellerCategoryEventAfterSave     = "erp.SellerCategoryAfterCreate erp.SellerCategoryAfterUpdate"
	SellerCategoryEventDelete        = "erp.SellerCategoryDelete"
	SellerCategoryAccessControlEvent = "erp.SellerCategoryAccessControl"
)

func GetSellerCategoryConfig() *mgo.DocConfig {
	return SellerCategory_Config
}

var SellerCategory_Config *mgo.DocConfig

func init() {
	SellerCategory_Config = NewSellerCategoryConfig()
}
func NewSellerCategoryConfig() *mgo.DocConfig {
	return &mgo.DocConfig{
		ContainerKey: "erp.SellerCategory",
		Fields: []string{
			"name", "sort", "l", "r", "level", "link", "parent", "children",
		},
		RelationFields: []string{
			"parent", "children",
		},
		RelationConfigs: map[string]*mgo.DocRelation{
			"parent": {
				Config:     GetSellerCategoryConfig,
				DocName:    "SellerCategory",
				JoinType:   "O",
				KeyInside:  "parentId",
				KeyOutSide: "id",
			},
			"children": {
				Config:     GetSellerCategoryConfig,
				DocName:    "SellerCategory",
				JoinType:   "M",
				KeyInside:  "id",
				KeyOutSide: "parentId",
			},
		},
		FieldFilter: map[string]*mgo.DocFieldFilter{
			"default": {
				Select: []string{},
				Omit:   []string{},
			},
		},
	}
}
